const express = require('express')
const app = express()
app.listen(8080)

app.get('/', (req, res) => {
  // 获取get参数
  let query = req.query

  res.send(query)
})

// 路由匹配规则是严格模式
// 文章详情 路由参数 /detail/100
app.get('/detail/:aid', (req, res) => {

  res.send(req.params.aid)
})

// /detail/100/zhangsan
app.get('/detail/:aid/:name', (req, res) => {
  // console.log(req.params.aid,req.params.name);
  // 解构赋值
  let { aid, name } = req.params

  res.send('aaa')
})